package com.shenw.common.card;

public enum PokerPoints {

	A, _2, _3, _4, _5, _6, _7, _8, _9, _10, J, Q, K;

	@Override
	public String toString() {
		String str = super.toString();
		int length = str.length();
		
		switch (str.length()) {
		case 1:	
			return str;
		case 2:
		case 3:
			return str.substring(length - 1);
		default:
			return null;
		}
	}
	
	public PokerPoints get(String name) {

		int c = (int)name.toCharArray()[0];
		switch (c) {
		case 65:
		case 97:
			return A;
		case 49:
			return _10;
		case 74:
		case 106:
			return J;
		case 81:
		case 113:
			return Q;
		case 75:
		case 107:
			return K;
		case 50:
			return _2;
		case 51:
			return _3;
		case 52:
			return _4;
		case 53:
			return _5;
		case 54:
			return _6;
		case 55:
			return _7;
		case 56:
			return _8;
		case 57:
			return _9;
		default:
			return null;
		}
	}
}
